home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Answers 2002 January
/
PC Answers January 2002.7z
/
PC Answers January 2002.bin
/
graphics
/
freepixl
/
_SETUP.1
/
Comms1.pxl
< prev
next >
Wrap
Text File
|
1998-02-18
|
5KB
|
189 lines
Initialize:
Title1$ = "Message Passing App #1"
Title2$ = "Message Passing App #2"
UseCaption(Title1$)
UseCoordinates(PIXEL)
UseBackGround(TRANSPARENT,192,192,192)
DrawBackGround
WinLocate(Title1$,250,10,680,240,Res)
{ WinShow(Title1$,NOTOPMOST,Res) }
DirGet(SourceDir$)
WinGetClientRect("",cx1,cy1,cx2,cy2)
InfoMenu(REMOVE)
WaitInput(100) {let NT and 95 catch up}
SetMenu("E&xit!",Leave,
ENDPOPUP,
"&Mode",IGNORE,
"Set &Transmit Mode",Transmit,
"Set &Receive Mode",Receive,
"&Loop",CommLoop,
SEPARATOR,
"Jump to Label",JumpLabel,
"Copy Data",CopyDataJump,
"Clear",Clear,
"Clear Both",ClearBoth,
ENDPOPUP,
"&Help",IGNORE,
"&Concept",Concept,
"&View Source",ViewSource,
"&About",About,
ENDPOPUP)
StatusWindow(ENABLE,BOTTOM,2,200,-1,0,0)
DrawStatusWinText(0,"Ready")
Loop = 0
Wait_for_Input:
WaitInput()
{ NOTE: if a PXLResume message is received while the
program is pausing at the above WaitInput(), it will
proceed directly to the next command, and then in this
case, exit.
You may want to program a simple solution around this,
such as ...
Goto Wait_for_Input
or instead use the PXLResumeAt(...) command. }
Leave:
WinClose(Title2$,Res)
End
Clear:
SetRightMouse()
SetMouse()
Loop = 0
DrawBackground
DrawStatusWinText(0,"Ready")
DrawStatusWinText(1,"")
Goto Wait_for_Input
ClearBoth:
SetRightMouse()
SetMouse()
Loop = 0
DrawBackground
DrawStatusWinText(0,"Ready")
DrawStatusWinText(1,"")
PXLresumeAt(Title2$,"Clear",Title1$,Res)
Goto Wait_for_Input
CopyDataJump:
Msg$ = "ReceiveCopyData Arbitary message from #1"
SendCopyDataMsg(Title2$,Msg$)
Goto Wait_for_Input
ReceiveCopyData:
GetCopyDataMsg(Msg$)
DrawText(10,70,Msg$)
Goto Wait_for_Input
JumpLabel:
PXLresumeAt(Title2$,"JumpLabel_2",Title1$,Res)
WaitInput(1)
{NOTE: in THIS SPECIFIC case, the WaitInput(1) is needed because the
application will overwrite the jump_label string. ie you must give the
target application time to process the command. You could also put
in a WaitInput() here and have the target application send a PXLresume}
PXLresumeAt(Title2$,"JumpLabel_2a",Title1$,Res)
WaitInput(1)
PXLresumeAt(Title2$,"JumpLabel_2b",Title1$,Res)
If Res = 0 Then MessageBox(OK,1,INFORMATION,"Resume in #2 failed","DEBUG",Res)
Goto Wait_for_Input
JumpLabel_1:
DrawBackground
DrawText(10,10,"Processed resume at JumpLabel_1 Message")
Goto Wait_for_Input
JumpLabel_1a:
DrawText(10,30,"Processed resume at JumpLabel_1a Message")
Goto Wait_for_Input
JumpLabel_1b:
DrawText(10,50,"Processed resume at JumpLabel_1b Message")
Goto Wait_for_Input
CommLoop:
Loop = 1
DrawStatusWinText(1,"Loop Enabled")
Goto Wait_for_Input
Transmit:
SetRightMouse(cx1,cy1,cx2,cy2,StopProcess,X,Y)
SetMouse(cx1,cy1,cx2,cy2,Process,X,Y)
DrawStatusWinText(0,"Transmit Enabled")
If Loop = 0 Then Goto Wait_for_Input
Receive:
WaitInput() {This is the WaitInput that the loop mode cycles around}
DrawBackGround
DrawIcon(10,10,64,64,ICON02)
WaitInput(1)
If Loop = 0 Then Goto Wait_for_Input
Process:
SetMouse()
PXLResume(Title2$,Res)
WaitInput(1)
If Res = 0 Then MessageBox(OK,1,INFORMATION,"Msg Failed",Title1$,Res)
If Loop = 1 Then Goto Receive
Goto Wait_for_Input
StopProcess:
Loop = 0
SetRightMouse()
DrawStatusWinText(0,"Ready")
Goto Receive {or the last 'resume' from #2 will hit Wait_for_Input then exit.}
Concept:
Loop = 0
SetMouse()
SetRightMouse()
DrawStatusWinText(0,"Ready")
MessageBox(OK,1,INFORMATION,
"This sample program demonstrates how two PiXCL
applications can communicate with each other by
passing a 'resume' message after a WaitInput()
command has been issued.
You can select transmit or receive ONE message at a time,
or select LOOP, then receive or transmit, and the two
programs will alternate sending 'resume' messages to
each other.
Once you have set up the transmit and receive modes,
click in the transmit window client area to start.
You can also send arbitary length messages to the
other window.
Clicking 'Exit' will close both message apps.",
"Message Passing",Res)
Goto Wait_for_Input
ViewSource:
PXLFile$ = SourceDir$ + "\comms1.pxl"
CmdLine$ = "NotePad " + PXLFile$
Run(CmdLine$)
Goto Wait_for_Input
About:
AboutUser("Message Passing with PiXCL 4.1",
"WaitInput(), PXLResume and PXLResumeAt commands.",
"A PXL application can wait for another application to tell it to continue at the current point or any label.")
Goto Wait_for_Input